why is `vapply` safer than `sapply`?

Posted by flodel on Stack Overflow See other posts from Stack Overflow or by flodel
Published on 2012-09-09T13:51:11Z Indexed on 2012/09/09 15:38 UTC
Read the original article Hit count: 67

Filed under:
|

The documentation says

vapply is similar to sapply, but has a pre-specified type of return value, so it can be safer [...] to use.

Could you please elaborate as to why it is generally safer, maybe provide examples?


P.S.: I know the answer and I already tend to avoid sapply. I just wish there was a nice answer here on SO so I can point my coworkers to it. Please, no "read the manual" answer.

© Stack Overflow or respective owner

Related posts about r

    Related posts about sapply